<?php
session_start(); 
ob_start();
?>

<?php
include 'connection.php';
if(isset($_GET['lang']))
{
$lang = $_GET['lang'];
}else{
$lang = 'en';
}
include 'cp/lang/'.$lang.'.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		
	<title><?= login ?></title>
		
		<link rel="stylesheet" href="cp/resources/css/<?= $lang ?>/invalid.css" type="text/css" media="screen" />	
		<link rel="stylesheet" href="cp/resources/css/<?= $lang ?>/reset.css" type="text/css" media="screen" />
	        <link rel="stylesheet" href="cp/resources/css/<?= $lang ?>/style.css" type="text/css" media="screen" />
		
	        <script type="text/javascript" src="cp/resources/scripts/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" src="cp/resources/scripts/simpla.jquery.configuration.js"></script>
		<script type="text/javascript" src="cp/resources/scripts/facebox.js"></script>
		<script type="text/javascript" src="cp/resources/scripts/jquery.wysiwyg.js"></script>
						
	</head>
  
	<body id="login">
	<div id="login-wrapper" class="png_bg">
	   <div id="login-top">
		<img id="logo" src="cp/img/logo1.png"  />
	   </div>
			
	   <div id="login-content">
<?php
 
  if (isset($_POST['submitForm'])) {
    $uname = $_POST['username'];
    $pass = $_POST['password'];
    $Query = mysql_query("SELECT * FROM admins WHERE username = '{$uname}' AND password = '{$pass}'");
    if (mysql_num_rows($Query) == 1) {
	$row = mysql_fetch_array($Query);
    $_SESSION['loggedin'] = 'YES';
    $_SESSION['uname'] = $uname;
	$_SESSION['id'] = $row['id'];
	
	
	
    header('Location: cp/index.php?lang='.$lang.'');
 
}
}

 ?>
                            <form action="login.php?lang=<?= $lang?>" method = "post" name = "form1">
				
				<p>
				<label><?= Username ?></label>
				<input class="text-input" type="text" name = "username"/>
				</p>
					<div class="clear"></div>
				<p>
				<label><?= Password ?></label>
				<input class="text-input" type="password" name = "password"/>
				</p>
					<div class="clear"></div>
				<p id="remember-password">
				<input type="checkbox" />  <?= Remember_me ?> </p>
					<div class="clear"></div>
				<p>
				<input class="button" type="submit" name = "submitForm" value="<?= login ?>" />
				</p>
				<a href ="login.php?lang=ar">Arabic</a>
                                <br/>
                                <a href ="login.php?lang=en">English</a>
				</form>
			   </div>
                </div> 
		
  </body>
  </html>
<?php  ob_flush();?>